/**
 * 批改路由
 * 定义作文批改相关的API端点
 */

import express from 'express';
import { authenticate } from '../middlewares/auth.js';
import { correctionPerformanceMonitor } from '../middlewares/monitor.js';
import * as correctionController from '../controllers/correctionController.js';

const router = express.Router();

// 所有批改相关的路由都需要认证
router.use(authenticate);

// GET /api/v1/corrections - 获取批改历史列表（注意：此路由必须在 /:essayId 之前）
router.get('/', correctionController.getCorrectionHistory);

// POST /api/v1/corrections/:essayId - 提交作文批改（添加性能监控）
router.post('/:essayId', correctionPerformanceMonitor, correctionController.correctEssay);

// GET /api/v1/corrections/:essayId - 获取批改结果（添加性能监控）
router.get('/:essayId', correctionPerformanceMonitor, correctionController.getCorrectionResult);

export default router;

